﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace telefonia
{
    public partial class AddCelular : Form
    {
        public AddCelular()
        {
            InitializeComponent();
        }

        private void AddCelular_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'miliData.Cliente' table. You can move, or remove it, as needed.
            this.clienteTableAdapter.Fill(this.miliData.Cliente);      
        }

        private void bAgregar_Click(object sender, EventArgs e)
        {
            CelularModel cel = new CelularModel();
            cel.Numero = xTnumero.Text.Trim();
            cel.Cliente = cbClients.SelectedIndex != -1 ? ((DataRowView)cbClients.Items[cbClients.SelectedIndex]).Row[3].ToString() : null;
            cel.Empresa = xTempresa.Text.Trim();
            cel.Linea = xTlinea.Text.Trim();
            cel.Modelo = xTmodelo.Text.Trim();
            DataBase.AddCelular(cel);
            this.Close();
        }
       
    }
}
